﻿using System.Text.RegularExpressions;

namespace System
{
    /// <summary>
    /// 正则表达式帮助类
    /// </summary>
    public class CRegex
    {
        /// <summary>
        /// 判断string是否符合正则表达
        /// </summary>
        /// <param name="str">待判断的string字符串</param>
        /// <param name="reg">正则表达式</param>
        /// <returns>结果</returns>
        public static bool IsMatch(string str, string reg)
        {
            bool error = true;         
            Match m = Regex.Match(str, reg);
            if (!m.Success)
            {
                error = false; ;
            }
            return error;
        }
    }
}
